#include "widget.h"
#include "ui_widget.h"

root_widget::root_widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::root_widget)
{
    ui->setupUi(this);


    // QListWidget 添加 Item

    // 1.addItem(QString)
    ui->list_widget->addItem("小蓝");

    // 2.addItem(QListWidgetItem)
    QListWidgetItem *item = new QListWidgetItem("小玉");
    // 文本设置居中展示
    item->setTextAlignment(Qt::AlignHCenter);
    ui->list_widget->addItem(item);

    // 3.addItems(QStringList)
    QStringList string_list;
    string_list << "小明" << "小白";
    ui->list_widget->addItems(string_list);
}

root_widget::~root_widget()
{
    delete ui;
}
